import logging,yagmail,yaml,json


def log_set():
    logging.basicConfig(filename='weipinhui.txt',level=logging.DEBUG,filemode='w+',
                        format=' %(asctime)s -> %(levelno)s -> %(message)s ')

def send_mail(filepath):
    mail=yagmail.SMTP(user='2440154941@qq.com',password='sgeliorajsvseaba',host='smtp.qq.com')
    mail.send(to='2440154941@qq.com',subject='唯品会自动化测试',contents='测试报告',attachments=filepath)

def get_data_from_yaml(file):
    with open(file,'r',encoding='utf_8') as f:
        return yaml.safe_load(f)

def get_data_from_json(files):
    with open(files,'r',encoding='utf_8') as f:
        return json.load(f)